<?php
class EventAction extends IntesysAction {
	public function add(){
		$this->display();	
	}
	public function insert(){
		if(IS_POST){
			$info=$this->dao->where(['task_id'=>$_POST['id']])->find();	
			$remark=$_POST['remark'];
			$num=$_POST['integralnumber'];
			$member=$_POST['member_id'];
			foreach($info as $k=>$v){
				$_POST[$k]=$v;
			}
			unset($_POST['num'],$_POST['id']);
			$_POST['remark']=$remark;
			$_POST['member_id']=$member;
			$_POST['integralnumber']=$num;
			$_POST['datetime']=time();
			parent::insert();
		}	
	}
	public function index(){
		$fDay=time(date('Y-m-01',time()));
		$eDay=strtotime(date('Y-m-d',fDay)." +1 month -1 day");
		$map="approver like ('%,".$this->UserInfo.",%') and site_id=".__SITEID__." and datetime>".$fDay." and datetime<".$eDay;
		$this->plus=$this->dao->where("integralnumber>0 and ".$map)->sum('integralnumber');
		$this->less=$this->dao->where("integralnumber<0 and ".$map)->sum('integralnumber');
		$this->display();
		
	}
}